import { stringifyNumber as s } from '../../stringify/stringifyNumber.js';
const e = t => typeof t == 'bigint' || Number.isInteger(t),
  o = (t, n, r, { intAsBigInt: i }) =>
    i ? BigInt(t) : parseInt(t.substring(n), r);
function f(t, n, r) {
  const { value: i } = t;
  return e(i) && i >= 0 ? r + i.toString(n) : s(t);
}
const a = {
    identify: t => e(t) && t >= 0,
    default: !0,
    tag: 'tag:yaml.org,2002:int',
    format: 'OCT',
    test: /^0o[0-7]+$/,
    resolve: (t, n, r) => o(t, 2, 8, r),
    stringify: t => f(t, 8, '0o'),
  },
  y = {
    identify: e,
    default: !0,
    tag: 'tag:yaml.org,2002:int',
    test: /^[-+]?[0-9]+$/,
    resolve: (t, n, r) => o(t, 0, 10, r),
    stringify: s,
  },
  u = {
    identify: t => e(t) && t >= 0,
    default: !0,
    tag: 'tag:yaml.org,2002:int',
    format: 'HEX',
    test: /^0x[0-9a-fA-F]+$/,
    resolve: (t, n, r) => o(t, 2, 16, r),
    stringify: t => f(t, 16, '0x'),
  };
export { y as int, u as intHex, a as intOct };
